package com.geostar.constructionland.analyse.service.analyseresult.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.geostar.constructionland.analyse.entity.statistics.SticDlfxTzh;
import com.geostar.constructionland.analyse.mapper.statistics.SticDlfxTzhMapper;
import com.geostar.constructionland.analyse.service.analyseresult.SticDlfxTzhService;
import com.geostar.constructionland.common.entity.response.LandInfo;
import com.google.common.collect.Lists;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author yelll
 * @since 2020-6-16 14:15
 **/
@Service
public class SticDlfxTzhServiceImpl extends ServiceImpl<SticDlfxTzhMapper, SticDlfxTzh> implements SticDlfxTzhService {

    @Override
    public double getKtzZymj() {
        return 0;
    }

    @Override
    public List<SticDlfxTzh> getSortedPdyFields(String fxbs, String sortType) {
        return this.baseMapper.getSortedPdyFields(fxbs, sortType);
    }

    @Override
    public List<SticDlfxTzh> getSortedDryIrgFields(String fxbs, String sortType) {
        return this.baseMapper.getSortedDryIrgFields(fxbs, sortType);
    }

    @Override
    public List<SticDlfxTzh> getSortedKtzFields(String fxbs, String sortType) {
        return this.baseMapper.getSortedKtzFields(fxbs, sortType);
    }

    @Override
    public List<SticDlfxTzh> getSortedBuildFields(String fxbs, String sortType) {
        return this.baseMapper.getSortedBuildFields(fxbs, sortType);
    }

    @Override
    public List<SticDlfxTzh> getSortedRestFields(String fxbs, String sortType) {
        return this.baseMapper.getSortedRestFiedls(fxbs, sortType);
    }

    @Override
    public List<SticDlfxTzh> getRestAdjustOri(String fxbs) {
        return this.baseMapper.getRestAdjustOriDlFxTzh(fxbs);
    }

    @Override
    public List<SticDlfxTzh> getKtzSticDlfxTzh(String fxbs) {
        return this.baseMapper.getKtzSticDlfxTzh(fxbs);
    }

    @Override
    public double getAdjustedTotalMjByDkxx(String fxid, String dkbs) {
        return this.baseMapper.getAdjustedTotalMjByDkxx(fxid, dkbs);
    }

    @Override
    public List<Map> getGdInfos(String fxbs) {
        return this.baseMapper.getGdInfo(fxbs);
    }

    @Override
    public void updateSticByAdjustedInfos(List<LandInfo> landInfos) {
        List<List<LandInfo>> groupList = Lists.partition(landInfos, 80); // 使用guava
        groupList.forEach(landInfos1 -> {
            this.baseMapper.updateSticDlfxTzh(landInfos1);
        });
    }

    @Override
    public List<SticDlfxTzh> getKtzFarmBuildList(String fxbs) {
        return this.baseMapper.getKtzFarmBuildList(fxbs);
    }

    @Override
    public void updateSticKtzmjAdjust(String fxbs) {
        this.baseMapper.updateSticKtzmjAdjust(fxbs);
    }

}
